package Share;

import java.io.DataInputStream;
import java.io.IOException;

public class SecureDataInputStream extends DataInputStream{
	private SecureInputStream stream;
	public SecureDataInputStream(SecureInputStream stream) {
		super(stream);
		this.stream = stream;
	}
	
	public SecureInputStream getStream()
	{
		return stream;
	}
	
	public void startHash()
	{
		stream.startHash();
	}
	
	public boolean checkhash() throws IOException
	{
		return stream.checkHash();
	}
	
	public boolean checkSig(Certificate certificate) throws IOException
	{
		return Util.checkSig(stream.getHash(), Util.readByteArray(this), certificate);
	}

	public boolean checkHash() throws IOException {
		return stream.checkHash();
	}
	
	public byte[] getAndCheckHash() throws IOException
	{
		return stream.getAndCheckHash();
	}

}
